package assg.funnycells.server;

import assg.funnycells.util.*;

public class CellState {
    public final static int SUSCEPTIBLE = 0;
    public final static int INFECTED = 1;
    public final static int ANTIBODY = 2;
    public final static int NEWINFECTED = 11;
    public final static int NEWANTIBODY = 12;
    public final static int ENERGY = 3;

    String cellId;
    int type;
    int x, y;
    int energy;
    long stateDrop;

    public CellState() {
	cellId = "";
	type = SUSCEPTIBLE;
	x = 0;
	y = 0;
	stateDrop = -1;
	energy = -1;
    }

    public void setCellId(String cellId) {
	this.cellId = cellId;
    }

    public void setType(int type) {
	this.type = type;
    }

    public void setPos(int x, int y) {
	this.x = x;
	this.y = y;
    }

    public void setEnergy(int energy) {
	this.energy = energy;
    }

    public void setLastStateDrop(long stateDrop) {
	this.stateDrop = stateDrop;
    }

    public String cellId() {
	return cellId;
    }

    public int type() {
	return type;
    }

    public int getX() {
	return x;
    }

    public int getY() {
	return y;
    }

    public int energy() {
	return energy;
    }

    public long lastStateDrop() {
	return stateDrop;
    }

    public static int newType(int type) {
	switch(type) {
	case assg.funnycells.server.CellState.SUSCEPTIBLE:
	    return  assg.funnycells.server.CellState.SUSCEPTIBLE;
	case assg.funnycells.server.CellState.NEWINFECTED:
	case assg.funnycells.server.CellState.INFECTED:
	    return  assg.funnycells.server.CellState.NEWINFECTED;
	case assg.funnycells.server.CellState.NEWANTIBODY:
	case assg.funnycells.server.CellState.ANTIBODY:
	    return assg.funnycells.server.CellState.NEWANTIBODY;
	}
	return -1;
    }

    public static int invNewType(int type) {
	switch(type) {
	case assg.funnycells.server.CellState.SUSCEPTIBLE:
	    return  assg.funnycells.server.CellState.SUSCEPTIBLE;
	case assg.funnycells.server.CellState.INFECTED:
	case assg.funnycells.server.CellState.NEWINFECTED:
	    return  assg.funnycells.server.CellState.INFECTED;
	case assg.funnycells.server.CellState.ANTIBODY:
	case assg.funnycells.server.CellState.NEWANTIBODY:
	    return assg.funnycells.server.CellState.ANTIBODY;
	}
	return -1;
    }
    

}